/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author wesleycl
 */
@Entity
@Table(name = "marketing_event")
@NamedQueries({@NamedQuery(name = "MarketingEvent.findAll", query = "SELECT m FROM MarketingEvent m")})
public class MarketingEvent implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @Column(name = "name")
    private String name;
    @Column(name = "createdtime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createdtime;
    @ManyToMany(mappedBy = "marketingEventCollection")
    private List<MaintenanceProject> maintenanceProjectCollection;

    public MarketingEvent() {
    }

    public MarketingEvent(Integer id) {
        this.id = id;
    }

    public MarketingEvent(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Date getCreatedtime() {
        return createdtime;
    }

    public void setCreatedtime(Date createdtime) {
        this.createdtime = createdtime;
    }

    public List<MaintenanceProject> getMaintenanceProjectCollection() {
        return maintenanceProjectCollection;
    }

    public void setMaintenanceProjectCollection(List<MaintenanceProject> maintenanceProjectCollection) {
        this.maintenanceProjectCollection = maintenanceProjectCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MarketingEvent)) {
            return false;
        }
        MarketingEvent other = (MarketingEvent) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.MarketingEvent[id=" + id + "]";
    }

}
